package com.tmt.im.common.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tmt.im.common.annotation._AllowUpdate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.ignite.cache.query.annotations.QuerySqlField;

import java.io.Serial;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/9/2 13:17
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class RedPackageDetailPoJo implements IGetKey<RedPackageDetailKey> {

    @Serial
    private static final long serialVersionUID = -4591600438005297874L;

    public static final String CACHE_NAME = "red_package_detail";

    @QuerySqlField(name = "id", index = true)
    private Long id;

    @QuerySqlField(name = "id", index = true)
    @JsonIgnore
    private Long mid;

    @QuerySqlField(name = "red_package_id")
    private Long redPackageId;

    @QuerySqlField(name = "red_package_type")
    private String redPackageType;

    @QuerySqlField(name = "session_id")
    private Long sessionId;

    @QuerySqlField(name = "amount")
    private Long amount;

    @QuerySqlField(name = "member_id")
    @_AllowUpdate
    private Long memberId;

    @QuerySqlField(name = "received_already")
    @_AllowUpdate
    @JsonIgnore
    private boolean receivedAlready;

    @QuerySqlField(name = "expire_time")
    @JsonIgnore
    private Timestamp expireTime;

    @QuerySqlField(name = "refunded")
    @_AllowUpdate
    @JsonIgnore
    private boolean refunded;

    @QuerySqlField(name = "received_time")
    @_AllowUpdate
    private Timestamp receivedTime;

    @QuerySqlField(name = "create_time")
    private Timestamp createTime;

    @QuerySqlField(name = "creator_id")
    @JsonIgnore
    private Long creatorId;

    @QuerySqlField(name = "version")
    @_AllowUpdate
    @JsonIgnore
    private Long version;

    @JsonIgnore
    private boolean insert;

    @Override
    public RedPackageDetailKey getKey() {
        return new RedPackageDetailKey(id, redPackageId);
    }
}
